﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using GrewalCRM.Entities;
using GrewalCRM.BLL;

/// <summary>
/// Summary description for CommonUtil
/// </summary>
public class CommonUtil
{
	public CommonUtil()
	{
		
	}

  public static void AddDefaultItemToDDL(DropDownList ddl, string DefaultText)
  {
    string DefaultPattern = "--{0}--";
    DefaultText = string.Format(DefaultPattern, DefaultText);
    ddl.Items.Insert(0, new ListItem( DefaultText, "0"));
  }

  public static Hashtable GetEnumForBind(Type enumeration)
  {
    string[] names = Enum.GetNames(enumeration);
    Array values = Enum.GetValues(enumeration);
    Hashtable ht = new Hashtable();
    for (int i = 0; i < names.Length; i++)
    {
      ht.Add(Convert.ToInt32(values.GetValue(i)).ToString(), names[i]);
    }
    return ht;
  }

  
}